package cn.g31010.sip.vo
{
	import com.adobe.serialization.json.JSON;
	
	public class Room 
	{
		
		public var id:String;

		public var name:String;

		public var passwd:String;

		public var owner:User;

		public var classes:Classes;

		public var gateway:Gateway;

		public var config:Config;

		public var status:String;
		[Bindable]
		public var admins:Array=new Array();
		[Bindable]
		public var whiteMembers:Array=new Array();
		[Bindable]
		public var blackMembers:Array=new Array();
		public var hessianTypeName:String = "cn.g31010.sip.pojo.Room";
		public function Room()
		{
		}
		public function toString():String{
			return JSON.encode(this);
		}
		
		public static function create(obj:Object):Room{
			if(obj==null)
				return null;
			var r:Room=new Room();
			if(obj.hasOwnProperty("id")){
				r.id=String(obj.id);
			}
			if(obj.hasOwnProperty("name")){
				r.name=String(obj.name);
			}
			if(obj.hasOwnProperty("passwd")){
				r.passwd=String(obj.passwd);
			}
			if(obj.hasOwnProperty("owner")){
				r.owner=User.create(obj.owner);
			}
			if(obj.hasOwnProperty("classes")){
				r.classes=Classes.create(obj.classes);
			}
			if(obj.hasOwnProperty("gateway")){
				r.gateway=Gateway.create(obj.gateway);
			}
			if(obj.hasOwnProperty("config")){
				r.config=Config.create(obj.config);
			}
			if(obj.hasOwnProperty("status")){
				r.status=String(obj.status);
			}
			if(obj.hasOwnProperty("admins")){
				var a:Array=obj.admins as Array;
				for(var i:int=0;i<a.length;i++){
					r.admins.addItem(User.create(a[i]));
				}
			}
			if(obj.hasOwnProperty("whiteMembers")){
				var a1:Array=obj.whiteMembers as Array;
				for(var j:int=0;j<a1.length;j++){
					r.whiteMembers.addItem(User.create(a1[j]));
				}
			}
			if(obj.hasOwnProperty("blackMembers")){
				var a2:Array=obj.blackMembers as Array;
				for(var k:int=0;k<a2.length;k++){
					r.blackMembers.addItem(User.create(a2[k]));
				}
			}
			return r;
		}
	}
}